<?php

	function parseBBQueueHTML($html) {

		preg_match_all('/<div[^>]+class\s*=\s*("|\')title("|\')[^>]*><a[^>]*>([^<]+)/m', $html, $matches);
		
		$titles = isset($matches[3]) ? $matches[3] : array();
		
		$actualTitles = array();
		
		foreach ($titles as $title)
			if (strcmp($title, 'Movie Title') != 0)
				$actualTitles[] = html_entity_decode(preg_replace('/\[[^\]]*]/', '', $title));
				
		return $actualTitles;
				
	}
	
	$fileName = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : false;
	
	if (!$fileName || !is_file($fileName))
		die("Invalid file name\n");

	$content = file_get_contents($fileName);

	print_r(parseBBQueueHTML($content));
	
?>